package com.ming.sevice.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ming.domain.SysLog;
import com.ming.mapper.SysLogMapper;
import com.ming.sevice.SysLogService;
import org.springframework.util.StringUtils;

/**
 *@Author:何元才
 *@Desc:
 *@data:2021-03-31 15:24
 */
@Service
public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> implements SysLogService{

    @Autowired
    private SysLogMapper sysLogMapper;
    /**
     * 分页查询日志
     *
     * @param page
     * @param sysLog
     * @return
     */
    @Override
    public Page<SysLog> findSysLogPage(Page<SysLog> page, SysLog sysLog) {
        return sysLogMapper.selectPage(page,new LambdaQueryWrapper<SysLog>()
                .like(StringUtils.hasText(sysLog.getUsername()),SysLog::getUsername,sysLog.getUsername())
                .like(StringUtils.hasText(sysLog.getOperation()), SysLog::getOperation, sysLog.getOperation())
                .orderByDesc(SysLog::getCreateDate)
        );

    }
}
